home *** CD-ROM | disk | FTP | other *** search
/ Network Supervisor's Toolkit / Network Supervisor's Toolkit.iso / tools / lu62 / prcv.c < prev    next >
C/C++ Source or Header  |  1996-07-10  |  4KB  |  138 lines

  1.  /********************************************************
  2.  *                                                       *
  3.  *               PERFORM_the_RECEIVE_PROCESSING          *
  4.  *                        (PRCV)                         *
  5.  *                                                       *
  6.  * Checks the appropriate receive buffer pool to see if  *
  7.  * any data has arrived for the conversation             *
  8.  * specified in the passed RECEIVE verb parametrs        *
  9.  *                                                       *
  10.  * INPUT : pointer to RECEIVE verb parametrs,            *
  11.  *         pointer to RCB.                               *
  12.  *                                                       *
  13.  * OUTPUT: The data will be removed from input buffer    *
  14.  *         and then will be placed in RECEIVE verb.      *
  15.  *                                                       *
  16.  *                                                       *
  17.  * CopyRight 1995. Nicholas Poljakov all rights reserved.*
  18.  *                                                       *
  19.  ********************************************************/
  20. #include <preptrcv.h>
  21. #include <state1.h>
  22. #include <rcb.h>
  23. #include <stdio.h>
  24. #include <tcb.h>
  25. #include <cma.h>
  26. #include <repass.h>
  27.  
  28. int sk_r_wt(void *);
  29. int SendBlock(void *, void *);
  30. int setrc(void *, void *);
  31. int sendhsf(void *);
  32. int sendhs(void *);
  33. int sendbm(void *, void *);
  34. int sendat(void *);
  35. int rtsend(void *);
  36. unsigned long rmfmh5(void *, void *);
  37. int recwait(void *);
  38. int rcvru(void *, void *);
  39. int rcvhs(void *, void *, void *, void *);
  40. int ralloc(void *, void *);
  41. int psrm(int, void *, void *);
  42. int ps_conv(int, void *);
  43. int proterr(void *, unsigned long);
  44. int post_rcb(void *);
  45. struct repass *postopen(void *);
  46. int phsrec(void *);
  47. int pfmh5(void *);
  48. int opndst(void *);
  49. int obtsess(void *, unsigned char);
  50. int Lrf_handler(void *);
  51. int get_sess(void *, void *);
  52. int get_attr(void *);
  53. int fsm_error(unsigned char, void *);
  54. int fsm_conv(unsigned char, unsigned char, void *);
  55. int flush (void *);
  56. int dcp(void *);
  57. int dealloc(void *);
  58. int crtp(void *);
  59. int conv(void *);
  60. int chkparm(void *, void *);
  61. int check_end(unsigned int, void *);
  62. struct rqb *call_appl(void *);
  63. int buffmng(unsigned char, void *, void *, void *, unsigned, unsigned char, unsigned);
  64. unsigned long attltck(void *);
  65. unsigned long attacheck(void *);
  66. char *cgetmem(int, int);
  67. int sendhsf(void *);
  68. int opndst(void *);
  69. int alloc_rcb(void *, void *);
  70. int allocate(void *);
  71. int clsdst(void *);
  72.  
  73. preptrcv(pptr)
  74. struct p_rcv *pptr;
  75. {
  76. struct rcb *p_rcb;
  77. struct tcb *ptr_tcb;
  78. struct cma ar;
  79. unsigned int type;
  80. struct repass *p_rep;
  81.  
  82. int  fsm_conv();
  83. int  fsm_error();
  84. char s;
  85. char r;
  86. char *p;
  87. int state;
  88.  
  89.  
  90.      s = 'S';
  91.      r = 'R';
  92.  
  93.      if (chkparm(pptr, &ar) == -1) {
  94.         return(0);
  95.      }
  96.      p_rcb = ar.p_rcb;
  97.      ptr_tcb = ar.p_tcb;
  98.  
  99. #if OS_TYPE == 1
  100.      /* Check if it RCB is in wait qeue */
  101.      if (sk_r_wt(p_rcb) == 0) {
  102.         ptr -> prim_rc = INCOMPLETE;
  103.         return (0);
  104.      }
  105. #endif
  106.  
  107.     /*   ó  RCB  ºá¡«ß¿¼ ¬«ñ »α¿¼¿Γ¿óá  */
  108.     p_rcb ->verb_code = Prepare_to_receive;
  109.  
  110.     if (p_rcb -> conv_state == SEND) {
  111.     p = &((*p_rcb).first_out);
  112.         type = PREP_TO_RCV_FLUSH;
  113.     buffmng('A', NULL, p, p_rcb, 0, 0, type);
  114.     sendhsf(p_rcb);
  115.     }
  116.  
  117.     p_rep = pptr;
  118.     if (p_rcb -> hsps != YES) {
  119.         p_rep -> complete = 1; /* req. to retry */
  120.     p_rep -> p_rcb = p_rcb;
  121.         return (0);
  122.     }
  123.     p_rep -> complete = 0; /* req. will be complete */
  124.     p_rep -> tp_fd = ptr_tcb -> tp_fd;
  125.  
  126.      if((state = fsm_conv(s, PREP_TO_RCV_FLUSH, p_rcb)) ==-1)
  127.           {
  128.               pptr -> prim_rc = PORT_ABENDED;
  129.               return;
  130.           }
  131.      if (state == 1)
  132.           {
  133.               pptr -> prim_rc = PORT_ABENDED;
  134.               return;
  135.           }
  136.      return 0;
  137. }
  138.